import request from '@/utils/request'
const baseUrl = '/mall/shoppingcart'

export function addCart(cartItem) {
  return request({
    url: `${baseUrl}/addShoppingCart`,
    method: 'post',
    data: cartItem
  })
}

// 获取用户的购物车
export function getUserCartPage(params) {
  return request({
    url: `${baseUrl}/pageCollectionByUserId/${params.userId}/${params.pageNum}/${params.pageSize}`,
    method: 'get'
  })
}

// 删除购物车
export function deleteCartById(id) {
  return request({
    url: `${baseUrl}/deleteById/${id}`,
    method: 'delete'
  })
}

// 修改购物车
export function updateCartById(cartItem) {
  return request({
    url: `${baseUrl}/updateById`,
    method: 'put',
    data: cartItem
  })
}

